﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SaleOnlineSystem.Controls
{
    public partial class GroupMain : System.Web.UI.UserControl
    {
        public int idCat { get; set; }
        public string title { get; set; }
        protected void Page_Load(object sender, EventArgs e)
        {

            // Kiem tra idCat xem co con khong neu có thi goi 
            bool check;
            check = BOL.CategoryManager.Instance.checkChild(ViewGroupProduct.dt, idCat);


            if (check == true)
            {
                // Load GroupParent
                GroupParent gp = (GroupParent)LoadControl("~/Controls/GroupParent.ascx");
                gp.catid = idCat;
                gp.title = title;
                plc_group.Controls.Add(gp);

            }

            else
            {
                // Load View Show Group
                ListShowGroupProduct lg = (ListShowGroupProduct)LoadControl("~/Controls/ListShowGroupProduct.ascx");
                lg.catid = idCat;
                lg.title = title;
                plc_group.Controls.Add(lg);
            }


        }
    }
}